(function () {
    axios.defaults.baseURL = 'http://124.223.14.236:3001/api'
    const form = document.querySelector("#content form");
    form.addEventListener("submit", async function (e) {
        const data = $(this).serialize();
        e.preventDefault();

        const { data: data1 } = await axios.post('/user/login', data)
        console.log(data1);
        if (!data1.success) return alert(data1.msg)
        localStorage.setItem('token', data1.data.token)
        localStorage.setItem('id', data1.data.id)
        alert("登录成功:我已经将token存在本地存储中了哦");
        // $.ajax({
        //     type: "POST",
        //     url: "http://124.223.14.236:3001/api/user/login",
        //     data: data,
        //     success: function (res) {
        //         console.log(res);
        //         if (!res.success) return alert("登录失败:" + res.msg);
        //         localStorage.setItem("token", res.data.token);
        //         localStorage.setItem("id", res.data.id);
        //         alert("登录成功:我已经将token存在本地存储中了哦");
        //     },
        // });
    });
})();